package tests.user;


/**
 * Copyright 2007, 2008 Viera K. Proulx
 * This program is distributed under the terms of the 
 * GNU Lesser General Public License (LGPL)
 */

/**
 * A sample abstract subclass to verify that tests include the common
 * field defined in the abstract class, as well as concrete methods
 * defined in the abstract class.
 *  
 * @author Viera K. Proulx
 * @since 29 October 2007
 */
public class ALibItemAudioBook extends ALibItemCD{
  public String author;
 
  /**
   * A constructor that initializes all fields - 
   * including the one from the superclass
   * 
   * @param title the title of this audio book
   * @param catNo the catalog number for this audio book
   * @param noDisks the number of CDs in this audio book CD collection
   * @param author the author of this audio book
   */
  public ALibItemAudioBook(String title, int catNo, 
  		                     int noDisks, String author){
    this.title = title;
    this.catNo = catNo;
    this.noDisks = noDisks;
    this.author = author;
  }
  
  /**
   * Compare the length of the title against the author
   * --- example of an abstract method implemented in the concrete subclass
   * 
   * @return true if the title has the same length as the author
   */
  public boolean sameLength(){
    return title.length() == author.length();
  }
  
  /**
   * Is this a book by the given author
   * --- an example of a method not defined or declared in the superclass
   * 
   * @return true if the author of this book is the same as the given one
   */
  public boolean sameAuthor(String author){
    return this.author.equals(author);
  }
}